package com.example.fragmenttest;

import android.app.Application;
import android.content.Context;

import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.assertNotNull;

@RunWith(AndroidJUnit4.class)
public class MyApplicationTest {




    @Test
    public void testApplicationNotNull(int target1,int[] arr) {


        int[] nums = new int[]{0,1,2,2,4,4,5};
        int target = 4;
        int left = 0,right=nums.length-1;
        int result = -1;

        while (left<=right){
            int mid = (right-left)/2;
            if(nums[mid]==target){

                result = mid;
                left = mid+1;
            } else if (nums[mid]<target) {

                left = mid+1;
            }
            else{
                right = mid-1;
            }

        }
        System.out.println(result);

    }



}